/**
 * 
 */
package com.base.myproject.client.busi.service;

import java.util.HashMap;

import com.base.myproject.client.busi.BaseStore;
import com.base.myproject.client.busi.BO.BusiObject;
import com.base.myproject.client.tools.Debug;
import com.base.myproject.client.ui.ToggleButtonX;
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
import com.extjs.gxt.ui.client.Style.VerticalAlignment;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.widget.Dialog;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.form.FieldSet;
import com.extjs.gxt.ui.client.widget.layout.TableData;
import com.extjs.gxt.ui.client.widget.layout.TableLayout;

/**
 * 收银管理的录入，可以同时录入技师，助理和相应的轮牌 指定 等方式
 * @author zgw
 *2010-1-3
 */
public class ServicePOInput   extends Dialog{

	java.util.HashMap<String, String[]> ht = new HashMap<String, String[]>();
	private BaseStore<BusiObject> store = null;
	
	public ServicePOInput()
	{
		super();
		init();
	}
	public ServicePOInput(BaseStore<BusiObject> store)
	{
		this.store = store;
	}
	void init()
	{
		aa();
		initWidget();
		
	}
	
	
	public BaseStore<BusiObject> getStore() {
		return store;
	}
	public void setStore(BaseStore<BusiObject> store) {
		this.store = store;
	}
	
	
	void initWidget()
	{
		/*ToggleButton tbutton = new ToggleButton("bu1");
		Menu menu = new Menu();  
	    menu.add(new CheckMenuItem("23"));  
	    menu.add(new MenuItem("Menu Item 2"));  
	    menu.add(new MenuItem("Menu Item 3"));  
		tbutton.setMenu(menu);
		add(new Button("test"));
		add(tbutton);
	//	tbutton.setAllowDepress(false);
		
		
		
		final ToggleButtonX tbutton2 = new ToggleButtonX("bu2",checkmenus);
		add(tbutton2);
		final ToggleButtonX tbutton3 = new ToggleButtonX("bu3",checkmenus);
		add(tbutton3);
		
		RadioGroup rg = new RadioGroup();
		Radio r = new Radio();
		r.setBoxLabel("eee1");
		Radio r2 = new Radio();
		r2.setBoxLabel("eee");
		rg.add(r);
		rg.add(r2);
		add(rg);
		*/
		Button b = new Button("button");
		b.addSelectionListener(new SelectionListener<ButtonEvent>(){

			@Override
			public void componentSelected(ButtonEvent ce) {
				// TODO Auto-generated method stub
				setValue();
			}
			
		});
		
		add(b);
		
		String[] checkmenus = new String[]{"1","2","3"};
		for(String str:ht.keySet())
		{
			FieldSet fs = new FieldSet();
			fs.setHeading(str);  
			fs.setLayout(new TableLayout(12));
			TableData td_isas2 = new TableData();
			td_isas2.setColspan(1);
			td_isas2.setRowspan(1);
			// 对齐方式
			td_isas2.setHorizontalAlign(HorizontalAlignment.RIGHT);
			td_isas2.setVerticalAlign(VerticalAlignment.TOP);
			
			for(String str2:ht.get(str))
			{
				ToggleButtonX tbx = new ToggleButtonX(str2,checkmenus);
				if(store!=null)
				{
					tbx.setStore(store);
				}
				fs.add(tbx,td_isas2);
			}
			add(fs);
		}
		
	}
	
	public void setValue()
	{
		Debug.printf(this.getItems().size());
	}
	
	void aa()
	{
		ht.put("a1", new String[]{"A1","A2","A3","A4"});
		ht.put("b2", new String[]{"B1","B2","B3","B4"});
		ht.put("c3", new String[]{"C1","C2","C3","C4"});
		
	}
	
	
}
